sqlite3: don't install ABI-less library
authorGeorge Sapkin <[email protected]>
Thu, 20 Nov 2025 13:51:23 +0000 (15:51 +0200)
committerGeorge Sapkin <[email protected]>
Sat, 22 Nov 2025 16:54:34 +0000 (18:54 +0200)
Don't install the ABI-less library to support potential multiple ABIs
side by side.

Add a matching tests to check the soname and ensure the ABI-less library
is not installed.

Fixes: aebfd49 ("sqlite3: bump to 3.49.1")
Signed-off-by: George Sapkin <[email protected]>
libs/sqlite3/Makefile
libs/sqlite3/test.sh

index bf002d4cc66028fa9a19b9a00d978f4391f5d137..484669cca1c94eedc360f1044e8dae57dc8b7ad2 100644 (file)
@@ -7,7 +7,7 @@ include $(TOPDIR)/rules.mk
 PKG_NAME:=sqlite
 PKG_VERSION:=3.51.0
 PKG_SRC_VERSION:=3510000
-PKG_RELEASE:=1
+PKG_RELEASE:=2
 
 PKG_SOURCE:=$(PKG_NAME)-autoconf-$(PKG_SRC_VERSION).tar.gz
 PKG_SOURCE_URL:=https://www.sqlite.org/2025/
@@ -137,7 +137,7 @@ endef
 
 define Package/libsqlite3/install
        $(INSTALL_DIR) $(1)/usr/lib
-       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libsqlite3.so* $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libsqlite3.so.{$(PKG_VERSION),$(ABI_VERSION)} $(1)/usr/lib
 endef
 
 define Package/sqlite3-cli/install
index 13af4783335f27dceebc397d793edd02563a22d7..ef84adcc6f3be413234008c91c03cbc3f24735a6 100755 (executable)
@@ -2,6 +2,44 @@
 #
 # SPDX-License-Identifier: GPL-2.0-only
 
-if [ "$1" = 'sqlite3-cli' ]; then
-       sqlite3 -version | grep -F "$PKG_VERSION"
-fi
+case "$PKG_NAME" in
+       libsqlite3)
+               apk add binutils
+
+               readelf_out=$(readelf --dynamic "/usr/lib/libsqlite3.so.$PKG_VERSION")
+               if [ $? -ne 0 ]; then
+                       echo "readelf failed for /usr/lib/libsqlite3.so.$PKG_VERSION" >&2
+                       exit 1
+               fi
+
+               soname=$(echo "$readelf_out" \
+                       | grep -F '(SONAME)' \
+                       | sed -E 's/.*\[(.*)\]/\1/')
+
+               if [ -z "$soname" ]; then
+                       echo "soname not found in /usr/lib/libsqlite3.so.$PKG_VERSION" >&2
+                       exit 1
+               fi
+
+               link_target=$(readlink "/usr/lib/$soname")
+               if [ $? -ne 0 ]; then
+                       echo "Failed to read soname link /usr/lib/$soname" >&2
+                       exit 1
+               fi
+
+               expected_target="libsqlite3.so.$PKG_VERSION"
+               if [ "$link_target" != "$expected_target" ]; then
+                       echo "soname link /usr/lib/$soname points to '$link_target', expected '$expected_target'" >&2
+                       exit 1
+               fi
+
+               if [ -f '/usr/lib/libsqlite3.so' ]; then
+                       echo "/usr/lib/libsqlite3.so shouldn't be installed" >&2
+                       exit 1
+               fi
+               ;;
+
+       sqlite3-cli)
+               sqlite3 -version | grep -F "$PKG_VERSION"
+               ;;
+esac